
package com.wjk.kylin.config.properties;


import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 云存储配置信息
 * 当项目已启动，spring接口，spring加载之后，执行接口一个方法
 */
@Component
public class AliCloudOSSProperties implements InitializingBean{
    //读取配置文件内容

    @Value("${aliyun.oss.domain}")
    private String domain;

    @Value("${aliyun.oss.prefix}")
    private String prefix;

    @Value("${aliyun.oss.endPoint}")
    private String endPoint;

    @Value("${aliyun.oss.accessKeyId}")
    private String accessKeyId;

    @Value("${aliyun.oss.accessKeySecret}")
    private String accessKeySecret;

    @Value("${aliyun.oss.bucketName}")
    private String bucketName;

    //定义公开静态常量
    public static String DOMAIN;
    public static String PREFIX;
    public static String END_POIND;
    public static String ACCESS_KEY_ID;
    public static String ACCESS_KEY_SECRET;
    public static String BUCKET_NAME;

    @Override
    public void afterPropertiesSet() throws Exception {
        DOMAIN = domain;
        PREFIX = prefix;
        END_POIND = endPoint;
        ACCESS_KEY_ID = accessKeyId;
        ACCESS_KEY_SECRET = accessKeySecret;
        BUCKET_NAME = bucketName;
    }

}

